#ifndef listpanel_h
#define listpanel_h

#include "juce_amalgamated.h"
#include "../SwitchablePanel.h"
#include "../BoundedPanel.h"
#include "../FoodObjects/Eatable.h"
#include "../BackButton.h"

#include "BoxModel.h"
#include "SearchField.h"
#include "ListPanelBox.h"
#include <vector>

using std::vector;

class ListPanel: public BoundedPanel, public SwitchablePanel
{
protected:
	BackButton* backButton;
	ListPanelBox* listBox;
	BoxModel* model;
	SearchField* search;
//	SearchField* searchWithin;
	Rectangle boxRect;
	Rectangle searchRect;

	deque<Eatable> filteredItems;

public:
	ListPanel(MasterComponent* master, int w, int h);
	~ListPanel();
	void paintListBox(Graphics& g);
	void resized();
	void filterList(vector<String> searchStrings);
	virtual deque<Eatable>& getEatableList() = 0;
	virtual void switchPanels(int, int) = 0;
	virtual void showItemView(int row) = 0;
	virtual void doubleClicked(const MouseEvent& e) = 0;
//	bool keyPressed(const KeyPress& key);
};

#endif
